<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="css/css.css" />
	<script src="js/jquery-1.10.1.min.js"></script>
	<script src="js/side.js" type="text/javascript"></script>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  <body>
	<div id="pageAll">
		<div class="pageTop">
			<div class="page">
				<img src="img/coin02.png" /><span><a href="home.jsp">首页</a>&nbsp;-&nbsp;-</span>&nbsp;教师管理
			</div>
		</div>

		<div class="page">
			<!-- user页面样式 -->
			<div class="connoisseur">
				<div class="conform">
					
						<div class="cfD">
						<form id="pager" method="post" action="teacher/query">
							<input type="hidden" name="currentPage" id="currentPage" value="${pageModel.currentPage }">
    						<input type="hidden" name="pageSize" id="pageSize" value="${pageModel.pageSize }">
							<input class="userinput" name="tname" type="text" placeholder="输入教师姓名" value="${teacher.tname }" />
							<button class="userbtn" type="submit" >查询教师</button>
							<button type="button" class="userbtn" id="addnew">添加教师</button>
						</form>
							
						</div>
					
				</div>
				<!-- user 表格 显示 -->
				<div class="conShow">
					<table border="1" cellspacing="0" cellpadding="0">
						<tr>
							<td width="166px" class="tdColor tdC">教师编号</td>
							<td width="335px" class="tdColor">教师姓名</td>
							<td width="100px" class="tdColor">教师性别</td>
							<td width="330px" class="tdColor">联系方式</td>
							<td width="350px" class="tdColor">教师职称</td>
							<td width="250px" class="tdColor">所属院系</td>
							<td width="130px" class="tdColor">操作</td>
						</tr>
							<c:forEach items="${pageModel.result }" var="t" >
						 		<tr height="40px">
								<td>${t.tid }</td>
						   		<td>${t.tname }</td>
						   		<td>${t.tsex }</td>
						   		<td>${t.tphone }</td>
						   		<td>${t.title }</td>
						   		<td>${t.m.mname }</td>	
								<td><a href="teacher/queryById?tid=${t.tid }"><img class="operation"
										src="img/update.png"></a> <a href="javascript:del(${t.tid })"><img class="operation delban"
									src="img/delete.png"></a></td>
								</tr>	
							</c:forEach>
						
					</table>
					<div class="paging">
					<%@include file="../../pageBar.jsp"%>
					</div>
				</div>
				<!-- user 表格 显示 end-->
			</div>
			<!-- user页面样式end -->
		</div>

	</div>



	<!-- 删除弹出框  end-->
</body>

</html>

<script>
    $(function () {
        

		$('#addnew').click(function(){

				window.location.href="teacher/init";
		 });


    });
	function del(id)
	{
		
		
		if(confirm("确定要删除吗？"))
		{
		
			var url = "teacher/delete?tid="+id;
			
			window.location.href=url;		
		
		}
	
	
	
	
	}
</script>